{% extends "base.html" %}
{% load alterflow_tags %}

{% block head %}
    我创建的变更
{% endblock %}

{% block content %}
    <ol class="breadcrumb" style="margin-bottom: 0;">
        <li><a href="#" style="font-size: large">变更管理</a></li>
        <li class="active" style="font-size: large">我创建的所有变更</li>
    </ol>
    <div>

        <div class="clearfix"
             style="height: 36px;line-height: 35px;padding: 0 15px;border-top: 1px solid #dddddd;background-color: #f1f0f0;">
            <i class="fa fa-table" aria-hidden="true"></i>
            <a href="{% url "workflow:add_alters" %}"
               style="display: inline-block;padding:0 10px;background-color: #428bca;color: #ffffff;float: right">
                <i class="fa fa-plus-circle" aria-hidden="true"></i>
                创建变更流程
            </a>
        </div>

        <table class="table table-bordered">
            <thead>
            <tr>
                <th>变更ID</th>
                <th>变更标题</th>
                <th>变更状态</th>
                <th>变更操作人</th>
                <th>变更提交时间</th>
                <th>变更类型</th>
                <th>目前流程状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% if result %}
                {% for row in result %}
                    <tr>
                        <td>{{ row.alter_id }}</td>
                        <td>{{ row.alter_title }}</td>
                        <td>{{ row.get_alter_status_display }}</td>
                        <td><a href="{% url 'users:user_info' row.operator.id %}">{{ row.operator.username }}</a></td>
                        <td>{{ row.date }}</td>
                        <td>{{ row.get_alter_type_display }}</td>
                        {% if row.flowrecord_set.last %}
                            <td><a class="btn-link" href="{% url 'workflow:alter_detail' row.alter_id %}">
                                {% get_flow_status row %}
                            </a></td>
                        {% else %}
                            <td>暂无已记录的提交流程</td>
                        {% endif %}
                        <td>

                            <a class="btn btn-primary btn-xs" href="{% url 'workflow:show_alter' row.alter_id %}">
                                <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                                查看变更详情
                            </a>
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td style="text-align: center" colspan="10"><span style="font-size: 20px">当前未提交变更流程!</span></td>
                </tr>
            {% endif %}

            </tbody>
        </table>
        <div class="clearfix">
            <ul class="pagination right" style="margin-top: 0">
                {{ page_str }}
            </ul>
        </div>
    </div>
{% endblock %}